package entities;

import java.io.Serializable;
import java.util.Date;

public class Order implements IOrder, Cloneable,Serializable{


	public OrderStatus orderStatus = null;
	public int number;
	private Date fillingDate;
	private Date deadlineDate;
	private Date beginingDate;
	private Integer price;
	private IMaster master;
	private IGarage garage;
	private Integer id;
	private IdManager idManager=IdManager.getInstance();
	
	
	public Order(){
		id=idManager.getOrderId();
		
	}
	public void setId(Integer id){
		this.id=id;
	}
	
	public Integer getId(){
		return id;
	}	
	
	public void setNumberOrder(int number) {
		this.number = number;
	}

	public void setFillingDate(Date fillingDate) {
		this.fillingDate = fillingDate;
	}

	public void setDeadlineDate(Date deadlineDate) {
		this.deadlineDate = deadlineDate;
	}

	public void setBeginingDate(Date beginingDate) {
		this.beginingDate = beginingDate;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public void sendMasterGarage(IMaster master, IGarage garage) {
		this.master = master;
		this.garage = garage;
		garage.markGarageNotEmpty(this);
		master.setOrder(this);
	}

	public IGarage getGarage() {
		return garage;
	}

	public int getNumberOrder() {
		return number;
	}

	public Date getFillingDate() {
		return fillingDate;
	}

	public Date getDeadlineDate() {
		return deadlineDate;
	}

	public Date getBeginingDate() {
		return beginingDate;
	}

	public Integer getPrice() {
		return price;
	}

	public IMaster getMaster() {
		return master;
	}

	public void setOrderStatus(OrderStatus ordSt) {
		this.orderStatus = ordSt;
	}

	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public void shiftTime(Date deadlineDate) {
		this.deadlineDate = deadlineDate;
	}

	public IOrder cloneOrder() throws CloneNotSupportedException {
		
		return (IOrder) super.clone();
		
		
	}

}
